Skip to content

Extend sales api cache timeout#3149

Merged
Crabcyborg merged 2 commits into
masterfrom
extend_sales_api_cache_timeout
Jun 16, 2026
Merged

Extend sales api cache timeout#3149
Crabcyborg merged 2 commits into
masterfrom
extend_sales_api_cache_timeout

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved API resilience and application stability by implementing intelligent cache timeout adjustments. When the external API service experiences rate limiting, the system automatically extends the cache duration to gracefully handle the situation, reducing failed requests and maintaining consistent user experience.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 38627e47-d133-412f-a150-3a72aac1323c

📥 Commits

Reviewing files that changed from the base of the PR and between 005a462 and 8d01296.

📒 Files selected for processing (1)
  • classes/models/FrmSalesApi.php

📝 Walkthrough

Walkthrough

A new protected get_cache_timeout( $addons ) method is added to FrmSalesApi. It returns '+1 hour' when the response_code key in $addons equals 429 (HTTP rate-limited), otherwise it returns the existing $this->cache_timeout value.

Changes

Rate-limit cache timeout adjustment

Layer / File(s) Summary
get_cache_timeout() helper for 429 responses
classes/models/FrmSalesApi.php
Adds the protected get_cache_timeout( $addons ) method; returns '+1 hour' when $addons['response_code'] is 429, otherwise returns $this->cache_timeout.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops past the API gate,
The server says "Too many! Please wait!"
So cache for an hour, be patient and kind,
No hammering doors — what a sensible mind.
🐇 ⏱️ 429? No worries, we'll hop back later!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Extend sales api cache timeout' directly and clearly describes the main change: implementing a new method that extends the cache timeout for the sales API when rate-limited.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch extend_sales_api_cache_timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io

deepsource-io Bot commented Jun 15, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 005a462...8d01296 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Jun 15, 2026 8:33p.m. Review ↗
JavaScript Jun 15, 2026 8:33p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@srwells

srwells commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

the doc comment is copy-pasted from the parent and still says "we'll need to check again sooner," but the code now backs off longer. And @since x.x is a placeholder that needs a real version before merge.

@Crabcyborg
Crabcyborg merged commit d690577 into master Jun 16, 2026
46 of 48 checks passed
@Crabcyborg
Crabcyborg deleted the extend_sales_api_cache_timeout branch June 16, 2026 12:08
@Crabcyborg

Crabcyborg commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@srwells We always use @since x.x and update this in the release process. That way the versions are never incorrect and I don't waste any time fixing versions.

Also, it still does back off for less time, but I agree we can improve the comment. I merged this before seeing your comment. I'll tweak it in my release changes I'm making today.

Thank you!

@coderabbitai coderabbitai Bot mentioned this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants